package com.ruoyi.transaction.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.transaction.mapper.ShopOrderItemMapper;
import com.ruoyi.transaction.domain.ShopOrderItem;
import com.ruoyi.transaction.service.IShopOrderItemService;

/**
 * 订单商品Service业务层处理
 * 
 * @author swy
 * @date 2025-08-07
 */
@Service
public class ShopOrderItemServiceImpl implements IShopOrderItemService 
{
    @Autowired
    private ShopOrderItemMapper shopOrderItemMapper;

    /**
     * 查询订单商品
     * 
     * @param id 订单商品主键
     * @return 订单商品
     */
    @Override
    public ShopOrderItem selectShopOrderItemById(Integer id)
    {
        return shopOrderItemMapper.selectShopOrderItemById(id);
    }

    /**
     * 查询订单商品列表
     * 
     * @param shopOrderItem 订单商品
     * @return 订单商品
     */
    @Override
    public List<ShopOrderItem> selectShopOrderItemList(ShopOrderItem shopOrderItem)
    {
        return shopOrderItemMapper.selectShopOrderItemList(shopOrderItem);
    }

    /**
     * 新增订单商品
     * 
     * @param shopOrderItem 订单商品
     * @return 结果
     */
    @Override
    public int insertShopOrderItem(ShopOrderItem shopOrderItem)
    {
        shopOrderItem.setCreateTime(DateUtils.getNowDate());
        return shopOrderItemMapper.insertShopOrderItem(shopOrderItem);
    }

    /**
     * 修改订单商品
     * 
     * @param shopOrderItem 订单商品
     * @return 结果
     */
    @Override
    public int updateShopOrderItem(ShopOrderItem shopOrderItem)
    {
        return shopOrderItemMapper.updateShopOrderItem(shopOrderItem);
    }

//    /**
//     * 批量删除订单商品
//     *
//     * @param ids 需要删除的订单商品主键
//     * @return 结果
//     */
//    @Override
//    public int deleteShopOrderItemByIds(Integer[] ids)
//    {
//        return shopOrderItemMapper.deleteShopOrderItemByIds(ids);
//    }
//
//    /**
//     * 删除订单商品信息
//     *
//     * @param id 订单商品主键
//     * @return 结果
//     */
//    @Override
//    public int deleteShopOrderItemById(Integer id)
//    {
//        return shopOrderItemMapper.deleteShopOrderItemById(id);
//    }
    /**
     * 批量删除订单商品（逻辑删除）
     */
    @Override
    public int deleteShopOrderItemByIds(Integer[] ids) {
        return shopOrderItemMapper.deleteShopOrderItemByIds(ids);
    }

    /**
     * 删除订单商品信息（逻辑删除）
     */
    @Override
    public int deleteShopOrderItemById(Integer id) {
        return shopOrderItemMapper.deleteShopOrderItemById(id);
    }
}
